function hasLost() {
  const hasLostUrl = "hasLost";
  fetch(hasLostUrl)
  .then(response => {
    if (response.ok) return response.text();
    else throw new Error("request failed");
  })
  .then(hasLost => {
    if (hasLost === "True") window.open ('youLost','_self',false);
  })
  .catch(error => {
    // if it fails wait 0.2s and repeat
    setTimeout(hasLost, 200);
  });

}
